package com.foreknow.eldclient.controller;

import com.foreknow.eldclient.po.Cart;
import com.foreknow.eldclient.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@ResponseBody
@RequestMapping("CartController")
public class CartController {
    @Autowired
    private CartService cS;
    @RequestMapping("/saveCart")
    public int saveCart(Cart cart){
        return cS.saveCart(cart);
    }

    @RequestMapping("/updateCart")
    public int updateCart(Cart cart) throws Exception {
        return cS.updateCart(cart);
    }

    @RequestMapping("/removeCart")
    public  int removeCart(Cart cart) throws Exception {
        return  cS.removeCart(cart);
    }

    @RequestMapping("/listCart")
    public List<Cart> listCart(Cart cart) throws Exception {
        return cS.listCart(cart);
    }

}
